package com.example.project;

import java.util.ArrayList;
import android.content.Context;
import android.view.LayoutInflater;
import android.view.View;
import android.view.ViewGroup;
import android.widget.BaseAdapter;
import android.widget.ImageView;
import android.widget.TextView;

public class GridAdapter extends BaseAdapter
{		
		private Context mContext;
		private ArrayList<String> mItems;
		public GridAdapter(Context c, ArrayList<String> items) {
		mContext = c;
		mItems = items;
		}
		@Override
		public int getCount() {
		return mItems.size();
		}
		@Override
		public Object getItem(int position) {
		return mItems.get(position);
		}
		@Override
		public long getItemId(int position) {
		return position;
		}
		@Override
		public View getView(int position, View convertView, ViewGroup parent) {
		View v = convertView;
		if (v == null) {
		LayoutInflater li = (LayoutInflater) mContext.getSystemService(Context.LAYOUT_INFLATER_SERVICE);
		v = li.inflate(R.layout.grid_item, null);
		TextView tv = (TextView)v.findViewById(R.id.grid_item_text);

		ImageView iv = (ImageView)v.findViewById(R.id.grid_item_image);
		switch (position) {
		case 0:
		tv.setText(R.string.menu_0);
		iv.setImageResource(R.drawable.ic_launcher);
		break;
		case 1:
	    tv.setText(R.string.menu_1);
		iv.setImageResource(R.drawable.ic_launcher);
		break;
		case 2:
	    tv.setText(R.string.menu_2);	
		iv.setImageResource(R.drawable.ic_launcher);
		break;
		case 3:
		tv.setText(R.string.menu_3);	
		iv.setImageResource(R.drawable.ic_launcher);
		break;
		case 4:
			tv.setText(R.string.menu_4);	
			iv.setImageResource(R.drawable.ic_launcher);
			break;
		case 5:
			tv.setText(R.string.menu_5);	
			iv.setImageResource(R.drawable.ic_launcher);
			break;
		case 6:
			tv.setText(R.string.menu_6);	
			iv.setImageResource(R.drawable.ic_launcher);
			break;
		case 7:
			tv.setText(R.string.menu_7);	
			iv.setImageResource(R.drawable.ic_launcher);
			break;
		}
		}
		return v;
		}
	
}
